Skip to content

Feat/gitlab include directive#25

Merged
ebuildy merged 14 commits into
mainfrom
feat/gitlab-include-directive
Jul 4, 2026
Merged

Feat/gitlab include directive#25
ebuildy merged 14 commits into
mainfrom
feat/gitlab-include-directive

Conversation

@ebuildy

@ebuildy ebuildy commented Jul 4, 2026

Copy link
Copy Markdown
Owner

No description provided.

ebuildy and others added 14 commits July 4, 2026 15:22
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Add plugin option to specify allowed remote hosts for ::include directives.
Defaults to empty array (all remote includes rejected).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Expand nested ::include directives found inside included markdown
files, guarded by a max depth cap and a per-branch cycle-detection
stack so a diamond-shaped include graph still resolves while a
self-referential one fails fast.

Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
…ipping

- Remote ::include fetches now use redirect: "manual" and reject 3xx
  responses explicitly, closing an allowlist-bypass path where an
  allowlisted host could redirect the build-time request elsewhere.
- Frontmatter stripping and recursive expansion now only apply to
  markdown targets, so non-markdown includes (e.g. .yml) keep a
  legitimate leading "---" block intact and are spliced in verbatim
  without being scanned for ::include directives.

Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Extract ::include expansion into an expandIncludes() factory that returns
an OutProcessor-shaped fn, and run it in transform.ts as a pre-render
source-processor stage (reusing applyOutProcessors) symmetric to the
post-render out-processor chain. Also render non-markdown include targets
(e.g. .yaml) as fenced, syntax-highlighted code blocks instead of raw
prose, matching {@includeGitlabFile}.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Add a `debug` plugin option (default false) that emits build-time traces
via @docusaurus/logger: each resolved {@includeGitlab…} placeholder
(project/ref/path, byte size) in transform.ts and each ::include directive
(target, depth, markdown-vs-fenced) in expand.ts. The logger lives in a
small isolated module that lazily imports @docusaurus/logger (an optional
peer dependency) only when enabled, with a defensive default-unwrap for the
CJS/ESM interop; a no-op logger is used otherwise.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
- Expand ::include directives inside fenced/inline code regions, inserting
  the target verbatim (GitLab 'includes in code blocks') instead of skipping
  them; prose directives keep markdown-inline/recurse and non-markdown
  code-fence behavior.
- Extend ::include support to the <GitlabReadme>/<GitlabFile> components:
  fetchReadme/fetchFile now expand directives on the raw markdown before
  renderMarkdown, with strict/allowedHosts/debug threaded into
  GitLabContext.options via buildContext.
- Clean up the ad-hoc full-document debug probe; keep the structured traces.
- Update spec, README, and tests accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
@ebuildy ebuildy force-pushed the feat/gitlab-include-directive branch from 69f98f3 to b948ded Compare July 4, 2026 13:22
@ebuildy ebuildy merged commit 2d6aff6 into main Jul 4, 2026
8 checks passed
@ebuildy ebuildy deleted the feat/gitlab-include-directive branch July 4, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant